<?php
include '../../../common.inc.php';
set_time_limit(0);
include __DIR__ . '/auto.func.php';
$startTime = microtime(true);
$start = isset($start) ? intval($start) : 0;
$sql = "select * from xd_auto_handler where id={$start} order by id asc limit 1 ";
var_dump($sql);
$one = $db->getOne($sql);
// $folder = "F:/Auto/比亚迪/比亚迪e6图片/";
// 3.5s
if (!$one) {
	exit('Handler Over');
} else {
	$folder = "F:/Picture/乘用车/{$one['first']}/{$one['second']}/";
}
//$folder = "F:/Auto/MG/AUSTIN SEVEN图片/";
$folderEncode = mb_convert_encoding($folder,"GB2312","UTF-8,GBK");

// 获取子目录所有分类
var_dump(_($folderEncode));
if (file_exists($folderEncode)) {
	$size = getDirSize($folderEncode);
} else {
	$size = '0000';
}
$endTime = microtime(true);
$time = $endTime - $startTime;
$sql = "update xd_auto_handler set   vsize='{$size}', vsizetime='{$time}' where id = {$one['id']}";
if(!$db->query($sql)){
	exit('Hander Wrong!');
}
$start+=1;
echo '<meta http-equiv="refresh" content="0; url='.$_SERVER['PHP_SELF'].'?start='.$start.'" />';
exit();